﻿#include "calibDialog.h"
#include "ui_calibDialog.h"

CalibDialog::CalibDialog(QWidget *parent) :
    QDialog(parent),
    ui(new Ui::CalibDialog)
{
    ui->setupUi(this);

    connect(ui->lineEditLength, SIGNAL(textChanged(const QString &)), this, SLOT(compute(const QString &)));
    connect(ui->pushButtonApply, SIGNAL(clicked()), this, SLOT(accept()));
}

void CalibDialog::setNameLength(QString name, double pixels)
{
    ui->labelLensName->setText(name);
    m_lenth_pixels = pixels;
    ui->lineEditPixels->setText(QString("%1").arg(m_lenth_pixels));

}

CalibDialog::~CalibDialog()
{
    delete ui;
}
void CalibDialog::compute(const QString &text)
{
    m_length_um = text.toDouble();
    um_per_pixel = m_length_um / m_lenth_pixels;
    ui->lineEditRes->setText(QString("%1").arg(um_per_pixel));
}

